package cn.edu.scau.cmi.zhuangjunsheng.Adapter;

import java.util.ArrayList;
import java.util.List;

public class AdapterOfClass extends SortUtil implements Target{

	public List<Student> sortStudent(List<Student> studentList) {
		List<Integer> intList = new ArrayList<Integer>();
		for(Student std:studentList) {
			int x=std.getID();
			intList.add(x);
		}
		intList = this.sortInt(intList);
		for (int i = 0; i < intList.size(); i++) {
			int j, number = intList.get(i);
			//System.out.println("?"+number);
			for (j = i+1; j < studentList.size(); j++) {
				Student student = studentList.get(j);
				if (student.getID() == number) {
					Student student1 = studentList.get(i);
					Student student2 = studentList.get(j);
					studentList.set(i, student2);
					studentList.set(j, student1);
					break;
				}
			}
		}
		return studentList;
	}
}
